pkg_name=coreutils
version=8.23
build_dir=$builds_dir_root/$pkg_name-cross-$version
src_dir=$src_dir_root/$pkg_name-$version
url=http://ftpmirror.gnu.org/$pkg_name/$pkg_name-$version.tar.xz

rm -Rf "$src_dir"
cd "$src_dir_root"
tar Jxf "$pkg_name-$version.tar.xz"

rm -Rf "$build_dir"
mkdir -p "$build_dir"
cd "$build_dir"

#of course, integrators did not test cross compilation against glibc... this is
#really a joke
cat >nyan-config.cache <<EOF
fu_cv_sys_stat_statfs2_bsize=yes
EOF

#usual perl crap, here related to man pages
cp -f "$builders_dir_root/$pkg_name/dummy-man" "$src_dir/man"

export CFLAGS=-O0
"$src_dir/configure"						\
	--cache-file=nyan-config.cache				\
	--build=$("$src_dir/build-aux/config.guess")		\
	--host=$gnu_target					\
	--prefix=/						\
	--enable-threads=posix					\
	--disable-acl						\
	--disable-assert					\
	--disable-rpath						\
	--enable-largefile					\
	--disable-xattr						\
	--disable-libcap					\
	--disable-nls						\
	--with-gnu-ld						\
	--without-included-regex				\
	--without-selinux					\
	--with-gmp		
unset CFLAGS

make

install_tmp_dir=/tmp/$pkg_name-cross-$version
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir"
make install "DESTDIR=$install_tmp_dir"

install_dirs_in_sysroot "$builders_dir_root/$pkg_name/runtime-cross.dirs" "$sysroot/"
install_files_in_sysroot "$builders_dir_root/$pkg_name/runtime-cross.files" "$install_tmp_dir/" "$sysroot/"
elf_strip_in_sysroot "$builders_dir_root/$pkg_name/elf-strip-cross" "$sysroot/"

rm -Rf "$install_tmp_dir"
rm -Rf "$build_dir"
rm -Rf "$src_dir"
